import { createRouter,createWebHashHistory,RouteRecordRaw } from 'vue-router';
import Layout from '../loyout/index.vue'
import Login from "../views/login.vue"
const routes:Array<RouteRecordRaw> = [
        {
          path:'/',
          redirect:'/login',
        },
        {
          path:'/login',
          component:Login,
        },
        {
          path:'/home',
          component:Layout,
          redirect:'/bench',
          children:[
            {
              path:'/bench',
              meta:{
                title:'修改审核',
                icon:'',
                parent:'报表管理'
              },
              component: () => import('../views/tables/bench.vue'),
            },
            {
              path:'/allData',
              meta:{
                title:'数据汇总',
              },
              component: () => import('../views/allData/index.vue'),
            },
            {
              path:'/flow',
              meta:{
                title:'流程管理',
                icon:''
              },
              component: () => import('../views/flow/index.vue'),
            },
            {
              path:'/userControl',
              meta:{
                title:'账户管理',
                icon:''
              },
              component: () => import('../views/tables/userControl.vue'),
            },
            {
              path:'/recycleBin',
              meta:{
                title:'回收站',
                icon:''
              },
              component: () => import('../views/recycleBin/index.vue'),
            },
            {
              path:'/assess',
              meta:{
                title:'综合评估',
                icon:''
              },
              component: () => import('../views/assess/assess.vue'),
            },
            {
              path:'/checkMsg',
              meta:{
                title:'查看公告',
                icon:''
              },
              component: () => import('../views/msgNotice/index.vue'),
            },
            {
              path:'/member',
              meta:{
                title:'成员管理',
                icon:''
              },
              component: () => import('../views/member/index.vue'),
            },
            {
              path:'/noReport',
              meta:{
                title:'报表录入',
                icon:'',
                parent:'报表管理'
              },
              component: () => import('../views/tables/noReport.vue'),
            },
            {
              path:'/returnReport',
              meta:{
                title:'已退回记录',
                icon:'',
                parent:'报表管理'
              },
              component: () => import('../views/tables/returnReport.vue'),
            },
            {
              path:'/investment',
              meta:{
                title:'招商引资数据',
                templateId:'8',
                query:'招商引资',
                parent:'报表管理'
              },
              component: () => import('../views/tables/editTable.vue'),
            },
            {
              path:'/imports',
              meta:{
                title:'进出口数据',
                templateId:'9',
                query:'进出口数据季度',
                parent:'报表管理'
              },
              component: () => import('../views/tables/editTable.vue'),
            },
            {
              path:'/monthReport',
              meta:{
                title:'月度报表',
                icon:'',
                query:'月报',
                parent:'报表管理'
              },
              component: () => import('../views/tables/comTable.vue'),
            },
            {
              path:'/quarterReport',
              meta:{
                title:'季度报表',
                icon:'',
                query:'季报',
                parent:'报表管理'
              },
              component: () => import('../views/tables/comTable.vue'),
            },
            {
              path:'/yearReport',
              meta:{
                title:'年度报表',
                icon:'',
                query:'年报',
                parent:'报表管理'
              },
              component: () => import('../views/tables/comTable.vue'),
            },
            //区中园
            {
              path:'/Park1',
              meta:{
                title:'苏陕协作“区中园”引进项目汇总台账',
                icon:'',
                query:'苏陕协作“区中园”引进项目汇总台账',
                parent:'报表管理'
              },
              component: () => import('../views/tables/comTable.vue'),
            },
            {
              path:'/Park2',
              meta:{
                title:'苏陕扶贫协作共建“区中园”月度工作台账',
                icon:'',
                query:'苏陕扶贫协作共建“区中园”月度工作台账',
                parent:'报表管理'
              },
              component: () => import('../views/tables/comTable.vue'),
            },
            {
              path:'/Park3',
              meta:{
                title:'“区中园”项目带动贫困人口信息表',
                icon:'',
                query:'“区中园”项目带动贫困人口信息表',
                parent:'报表管理'
              },
              component: () => import('../views/tables/comTable.vue'),
            },
            //经开区
            {
              path:'/compeny1',
              meta:{
                title:'主导产品产量情况',
                icon:'',
                query:'主导产品产量情况',
                parent:'报表管理'
              },
              component: () => import('../views/tables/comTable.vue'),
            },
            {
              path:'/compeny2',
              meta:{
                title:'工业总产值分行业情况',
                icon:'',
                query:'工业总产值分行业情况',
                parent:'报表管理'
              },
              component: () => import('../views/tables/comTable.vue'),
            },
            {
              path:'/compeny3',
              meta:{
                title:'重点工业产品产量情况',
                icon:'',
                query:'重点工业产品产量情况',
                parent:'报表管理'
              },
              component: () => import('../views/tables/comTable.vue'),
            },
            {
              path:'/compeny5',
              meta:{
                title:'“四上”企业情况',
                icon:'',
                query:'“四上”企业情况',
                parent:'报表管理'
              },
              component: () => import('../views/tables/comTable.vue'),
            },
          ]
        },
        {
          path:'/check',
          component: () => import('../views/tables/checkTable.vue'),
        },
        {
          path:'/dominantCheck',
          component: () => import('../views/tables/dominantCheck.vue'),
        },
        {
          path:'/fourCheck',
          component: () => import('../views/tables/fourCheck.vue'),
        },
        {
          path:'/summary',
          component: () => import('../views/tables/summary.vue'),
        },
        {
          path:'/staging',
          component: () => import('../views/tables/staging.vue'),
        },
        {
          path:'/poor',
          component: () => import('../views/tables/poor.vue'),
        },
        {
          path:'/addFloder',
          component: () => import('../views/flow/addFloder.vue'),
        },
        {
          path:'/assessTable',
          component: () => import('../views/assess/tables.vue'),
        },
        
        
]

const router = createRouter({
  history:createWebHashHistory(),
  routes
})
router.beforeEach((to,from,next) =>{
const token = sessionStorage.getItem("token")
  if(!token && to.path !== '/login'){
    next('/login');
  }else{
    if(token && to.path == '/login'){
      next("/monthReport")
    }
    next()
  }
})
export default router
